var Excel = require('exceljs');
var start_time = new Date();
var workbook = new Excel.stream.xlsx.WorkbookWriter({
    filename: './data-shijian2.xlsx'
});
var worksheet = workbook.addWorksheet('Sheet');
//最小值 2017/12/18 13:42:13.000. 
//最大值 2017/12/24 13:37:49.000.
worksheet.columns = [{
    header: 'time',
    key: 'time'
}];
var data = []
var data2 = [
    '2017/12/18 13:42:13.000.', '2017/12/18 13:48:49.000.', '2017/12/99 13:48:49.000.'
];

function TWO(num) {
    return (Array(2).join(0) + num).slice(-2);
}

let s = 0;
let f = 0;
let m = 0;

// 86400
for (let i = 0; i < 86400; i++) {
    if (m === 60) {
        m = 0;
        f++;
        // 00:01:00.000.
        if (f === 60) {
            f = 0;
            s++;
        }
        data.push(`2017/12/19 ${TWO(s)}:${TWO(f)}:${TWO(m)}.000.`)
        m = 1;
    } else {
        data.push(`2017/12/19 ${TWO(s)}:${TWO(f)}:${TWO(m)}.000.`)
        m++;
    }
}
// console.log('for', data);

console.log('开始添加数据');
// 开始添加数据
for (let i in data) {
    worksheet.s({
        'time': data[i]
    }).commit();
}
console.log('添加数据完毕：', (Date.now() - start_time));
workbook.commit();

var end_time = new Date();
var duration = end_time - start_time;

console.log('用时：' + duration);
console.log("程序执行完毕");